package com.unionpay.acp.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.view.JstlView;
import org.springframework.web.servlet.view.UrlBasedViewResolver;

/**
 * @author caizw
 * @date 2018-08-23
 * @description:
 */
@Configuration
@Component
public class WebMvcConfigurer extends WebMvcConfigurerAdapter {
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/**","/**")
                .addResourceLocations("/WEB-INF/static/","classpath:/static/");

    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        super.addInterceptors(registry);
    }

       @Bean
       public UrlBasedViewResolver viewResolver() {
           UrlBasedViewResolver viewResolver = new UrlBasedViewResolver();
           viewResolver.setViewClass(JstlView.class);
           viewResolver.setPrefix("/WEB-INF/jsp/");
           viewResolver.setSuffix(".jsp");
           return viewResolver;
       }
}